/*
 * @(#)XfslStatus.java        1.0 2000/05/09
 *
 * This file is part of Xfuzzy 3.0, a design environment for fuzzy logic
 * based systems.
 *
 * (c) 2000 IMSE-CNM. The authors may be contacted by the email address:
 *                    xfuzzy-team@imse.cnm.es
 *
 * Xfuzzy is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Xfuzzy is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

package xfuzzy.xfsl.model;

/**
 * Clase que almacena el estado de un proceso de ajuste paramatrico
 * 
 * @author Francisco Jose Moreno Velo
 * 
 */
public class XfslStatus implements Cloneable {

	// ----------------------------------------------------------------------------//
	// COSTANTES P�BLICAS //
	// ----------------------------------------------------------------------------//

	/**
	 * Proceso no configurado
	 */
	public static final int UNCONFIGURED = 0;

	/**
	 * Proceso configurado y listo para ejecutarse
	 */
	public static final int READY_TO_RUN = 1;

	/**
	 * Proceso en ejecucion
	 */
	public static final int LEARNING = 2;

	/**
	 * Proceso detenido en mitad de una ejecucion
	 */
	public static final int STOPPED = 3;

	/**
	 * Proceso finalizado
	 */
	public static final int FINISHED = 4;

	/**
	 * Proceso deteniendose
	 */
	public static final int STOPPING = 5;

	// ----------------------------------------------------------------------------//
	// MIEMBROS P�BLICOS //
	// ----------------------------------------------------------------------------//

	/**
	 * Codigo del estado
	 */
	public int status;

	/**
	 * Iteracion en la que se encuentra el proceso
	 */
	public long epoch;

	/**
	 * Flag que indica si se realiza un test en paralelo con el aprendizaje
	 */
	public boolean testing;

	/**
	 * Evaluacion de la fase de aprendizaje
	 */
	public XfslEvaluation trn;

	/**
	 * Evaluaci�n de la fase de test
	 */
	public XfslEvaluation tst;

	// ----------------------------------------------------------------------------//
	// CONSTRUCTOR //
	// ----------------------------------------------------------------------------//

	/**
	 * Constructor
	 */
	public XfslStatus() {
		this.status = UNCONFIGURED;
		this.epoch = 0;
		this.testing = true;
		this.trn = new XfslEvaluation();
		this.tst = new XfslEvaluation();
	}

	// ----------------------------------------------------------------------------//
	// METODOS PUBLICOS //
	// ----------------------------------------------------------------------------//
	/**
	 * Descripcin del estado a almecenar en el fichero de log
	 */
	public String toString() {
		return "" + this.epoch + " " + this.trn + " " + this.tst + "\n";
	}

	/**
	 * Duplicado del estado
	 */
	public Object clone() {
		XfslStatus clone = new XfslStatus();
		clone.status = this.status;
		clone.epoch = this.epoch;
		clone.testing = this.testing;
		clone.trn = (XfslEvaluation) this.trn.clone();
		clone.tst = (XfslEvaluation) this.tst.clone();
		return clone;
	}
}
